<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
	<title>邮件发送测试</title>
    <base href="{:request()->domain()}" />
    <link href="__STATIC__/admin1/css/bootstrap.css" rel="stylesheet">
    <link href="__STATIC__/admin1/css/common.css" rel="stylesheet">
    <link href="__STATIC__/admin1/css/admin.css" rel="stylesheet">
	<script src="__STATIC__/admin1/js/jquery-1.12.0.min.js"></script>
    <script src="__STATIC__/admin1/js/bootstrap.min.js"></script>
    <script src="__STATIC__/admin1/js/jquery.qrcode.min.js"></script>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
</head>
<body>
<div class="container">
	<div class="panel panel-default">
		<div class="panel-heading">
			<strong>邮件发送测试</strong>
		</div>
		<div class="panel-body">
			<form class="form-horizontal email-form" method="post" action="{:url('index/email/email')}">
				<div class="form-group">
					<label class="col-sm-2 control-label">收件人邮箱</label>
					<div class="col-sm-10">
						<input type="text" class="form-control" name="email" value="">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">邮件标题</label>
					<div class="col-sm-10">
						<input type="text" class="form-control" name="subject" value="测试邮件">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">邮件内容</label>
					<div class="col-sm-10">
						<textarea class="form-control" row="6" name="message">测试邮件内容</textarea>
					</div>
				</div>
				<div class="form-group">
					<div class="col-sm-offset-2 col-sm-10">
						<button type="submit" class="btn btn-success">发送邮件</button>
					</div>
				</div>
			</form>
		</div>
		<div class="panel-footer">&nbsp;</div>
	</div>
</div>
<script>
	$(function(){
		$('.email-form').submit(function(){
			var $this = $(this);
			if(!$this.hasClass('lock-form')){
				$this.addClass('lock-form');//锁定表单
				var formData = new FormData($this[0]);
				$.ajax({
					url:$this.attr("action"),
					type:'POST',
					data:formData,
					dataType:'json',
					cache: false,
					contentType: false,
					processData: false,
					success:function(s){
						$this.removeClass('lock-form');//解锁表单
						$('.panel-footer').html(s.msg);
						return false;
					}
				});
			}
			return false;
		});
	});
</script>
</body>
</html>